import {
  CATEGORY_TYPE_OPTIONS,
  WHETHER_OPTIONS,
  ENABLE_OPTIONS,
} from '@/constants/basics';

export const ALL_FORM_ITEMS = [
  {
    prop: 'categoryType',
    label: '商品品类',
    options: CATEGORY_TYPE_OPTIONS,
    isBasic: true,
  },
  {
    prop: 'parentUuidStr',
    label: '父级分类',
    isBasic: true,
  },
  {
    prop: 'categoryName',
    label: '分类名称',
    isBasic: true,
  },
  {
    prop: 'categoryNo',
    label: '分类编码',
    isBasic: true,
  },
  {
    prop: 'labelNames',
    label: '关联品类标签',
    isBasic: true,
  },
  {
    prop: 'position',
    label: '位置',
    isBasic: true,
  },
  {
    prop: 'state',
    label: '是否启用',
    type: 'radio',
    options: ENABLE_OPTIONS,
    isBasic: true,
  },
  {
    prop: 'categoryNote',
    label: '描述',
    isBasic: true,
  },
  {
    prop: 'notSpecAttrs',
    label: '基本属性',
    isBasic: true,
    slotName: 'notSpecAttrs',
  },
  {
    prop: 'specAttrs',
    label: '规格属性',
    isBasic: true,
    slotName: 'specAttrs',
  },
  {
    prop: 'productTemplateNames',
    label: '关联商品模板'
  },
  {
    prop: 'unitNames',
    label: '计量单位'
  },
  {
    prop: 'acceptItemNames',
    label: '关联验收事项'
  },
  {
    prop: 'classificationNames',
    label: '关联归类名称'
  },
  {
    prop: 'isPriceSensitive',
    label: '是否价格敏感',
    type: 'radio',
    options: WHETHER_OPTIONS
  },
  {
    prop: 'productQualificationNames',
    label: '商品资质类型'
  },
  {
    prop: 'classifyQualificationNames',
    label: '分类资质类型'
  },
  {
    prop: 'guideAddRate',
    label: '售价指导加价率'
  },
  {
    prop: 'sellWellAddRate',
    label: '畅销指导加价率'
  },
  {
    prop: 'limitAddRate',
    label: '成交最低加价率'
  },
]

export const BASE_FORM_ITEMS = ALL_FORM_ITEMS.filter(item => item.isBasic)

export const ModifyTypeEnum = {
  '1': '新增',
  '2': '编辑',
  '3': '删除'
}

export const BRAND_TABLE_COLUMNS = [
  {
    title: '品牌名称',
    key: 'brandName'
  },
  {
    title: '售价指导加价率',
    key: 'guideAddRate'
  },
  {
    title: '成交最低加价率',
    key: 'limitAddRate'
  },
  {
    title: '状态',
    render: (h, { row }) => <span>{ModifyTypeEnum[row.modifyType] ?? ''}</span>
  }
]
